<template>
  <view class="container">
    <!-- 顶部区域 -->
    <view class="header">
      <view class="status-bar"></view>
      <view class="logo-section">
        <view class="logo-wrapper">
          <image class="logo" src="/static/logo.png"></image>
        </view>
        <text class="greeting">您好</text>
        <text class="sub-greeting">欢迎使用吏简合同服务</text>
      </view>
    </view>

    <!-- 主要功能区域 -->
    <view class="main-content">
      <!-- 打借条卡片 -->
      <view class="main-card" @click="goToBorrow">
        <view class="card-content-wrapper">
          <view class="card-icon">
            <view class="icon-bg">
              <text class="icon">📋</text>
            </view>
          </view>
          <view class="card-content">
            <text class="card-title">打借条</text>
            <text class="card-desc">安全、高效的创建合同</text>
          </view>
          <view class="card-arrow">
            <text class="arrow">→</text>
          </view>
        </view>
      </view>

      <!-- 功能网格 -->
      <view class="function-grid">
        <view class="grid-item" @click="goToCustomerService">
          <view class="grid-icon">
            <view class="icon-circle customer-service">
              <text class="icon">🎧</text>
            </view>
          </view>
          <text class="grid-title">在线客服</text>
          <text class="grid-desc">人工客服，快速咨询</text>
        </view>

        <view class="grid-item" @click="goToLegalConsult">
          <view class="grid-icon">
            <view class="icon-circle legal">
              <text class="icon">⚖️</text>
            </view>
          </view>
          <text class="grid-title">法律咨询</text>
          <text class="grid-desc">专业法律问题解答</text>
        </view>

        <view class="grid-item" @click="goToComplaint">
          <view class="grid-icon">
            <view class="icon-circle complaint">
              <text class="icon">💬</text>
            </view>
          </view>
          <text class="grid-title">投诉意见</text>
          <text class="grid-desc">有问题，及时反馈</text>
        </view>

        <view class="grid-item" @click="goToContractReminder">
          <view class="grid-icon">
            <view class="icon-circle reminder">
              <text class="icon">📅</text>
            </view>
          </view>
          <text class="grid-title">履约提醒</text>
          <text class="grid-desc">到期提醒，防违约</text>
        </view>
      </view>
    </view>
  </view>
</template>

<script setup>
import { ref } from "vue";

const title = ref("您好");

// 跳转到打借条页面
function goToBorrow() {
  uni.navigateTo({
    url: '/pages/borrow/identity'
  })
}

// 跳转到在线客服
function goToCustomerService() {
  console.log("跳转到在线客服");
}
// 跳转到法律咨询
function goToLegalConsult() {
  uni.navigateTo({
    url: '/pages/home/consulting'
  })
}
// 跳转到投诉意见
function goToComplaint() {
  uni.navigateTo({
    url: '/pages/home/comment'
  })
}
// 跳转到履约提醒
function goToContractReminder() {
  uni.navigateTo({
    url: '/pages/home/contract'
  })
}
</script>

<style>
.container {
  min-height: calc(100vh - 100rpx);
  background: #f8fafc;
  display: flex;
  flex-direction: column;
}

/* 状态栏占位 */
.status-bar {
  height: var(--status-bar-height, 44rpx);
}

/* 顶部区域 */
.header {
  padding: 20rpx 40rpx 60rpx;
  text-align: center;
  background: linear-gradient(180deg, #6366f1 0%, #8b5cf6 100%);
  position: relative;
}

.logo-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  animation: fadeInUp 0.8s ease-out;
}

.logo-wrapper {
  position: relative;
  margin-bottom: 30rpx;
  margin-top: 30rpx;
}

.logo {
  width: 140rpx;
  height: 140rpx;
  border-radius: 28rpx;
}

.greeting {
  font-size: 56rpx;
  font-weight: 700;
  color: #fff;
  margin-bottom: 10rpx;
  letter-spacing: 2rpx;
}

.sub-greeting {
  font-size: 28rpx;
  color: rgba(255, 255, 255, 0.9);
  font-weight: 400;
  letter-spacing: 1rpx;
}

/* 主要内容区域 */
.main-content {
  flex: 1;
  padding: 0 30rpx;
  padding-bottom: 40rpx;
  margin-top: -30rpx;
  position: relative;
  z-index: 1;
}

/* 打借条主卡片 */
.main-card {
  border-radius: 24rpx;
  margin-bottom: 50rpx;
  overflow: hidden;
  transform: translateY(0);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.main-card:active {
  transform: translateY(4rpx) scale(0.98);
}

.card-content-wrapper {
  padding: 45rpx;
  display: flex;
  align-items: center;
  background: #fff;
  box-shadow: 0 4rpx 20rpx rgba(0, 0, 0, 0.08);
  border: 1rpx solid #e2e8f0;
}

.card-icon {
  margin-right: 35rpx;
}

.icon-bg {
  width: 120rpx;
  height: 120rpx;
  border-radius: 24rpx;
  background: #6366f1;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8rpx 20rpx rgba(99, 102, 241, 0.3);
}

.card-icon .icon {
  font-size: 60rpx;
}

.card-content {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.card-title {
  font-size: 42rpx;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 12rpx;
  letter-spacing: 1rpx;
}

.card-desc {
  font-size: 28rpx;
  color: #64748b;
  font-weight: 400;
  line-height: 1.5;
}

.card-arrow {
  margin-left: 20rpx;
}

.arrow {
  font-size: 40rpx;
  color: #6366f1;
  font-weight: bold;
}

/* 功能网格 */
.function-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 25rpx;
}

.grid-item {
  background: #fff;
  border-radius: 20rpx;
  padding: 45rpx 30rpx;
  text-align: center;
  box-shadow: 0 4rpx 20rpx rgba(0, 0, 0, 0.08);
  border: 1rpx solid #e2e8f0;
  display: flex;
  flex-direction: column;
  align-items: center;
  transform: translateY(0);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.grid-item:active {
  transform: translateY(2rpx) scale(0.98);
}

.grid-icon {
  margin-bottom: 25rpx;
}

.icon-circle {
  width: 100rpx;
  height: 100rpx;
  border-radius: 20rpx;
  display: flex;
  align-items: center;
  justify-content: center;
}

.customer-service {
  background: #f1f5f9;
  color: #6366f1;
}

.legal {
  background: #f0fdf4;
  color: #16a34a;
}

.complaint {
  background: #fef3c7;
  color: #d97706;
}

.reminder {
  background: #fdf2f8;
  color: #ec4899;
}

.grid-icon .icon {
  font-size: 45rpx;
}

.grid-title {
  font-size: 32rpx;
  font-weight: 600;
  color: #1e293b;
  margin-bottom: 12rpx;
  letter-spacing: 0.5rpx;
}

.grid-desc {
  font-size: 24rpx;
  color: #64748b;
  line-height: 1.4;
  font-weight: 400;
}

/* 动画效果 */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(60rpx);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 响应式设计 */
@media (max-width: 750rpx) {
  .main-content {
    padding: 0 20rpx;
  }

  .function-grid {
    gap: 20rpx;
  }

  .grid-item {
    padding: 35rpx 25rpx;
  }
}
</style>
